<div class="bjui-pageContent">
<php>$num = $va['num'] - $va['send_num'];</php>
    <form action="{:U('save_send_code')}" data-callback="getcodecall" data-toggle="validate" data-alertmsg="false" class="dialogForm">
        <input type="hidden" name="id" value="{$va.id}"/>
        <div class="form-group">
            <label class="x100">优惠券名:</label>
            <input type="text" name="" data-rule="required" readonly value="{$va.name}" />
        </div>
        <div class="form-group">
            <label class="x100">面值:</label>
            <input type="text" name="" data-rule="required" readonly value="{$va.value}" />
        </div>
        <div class="form-group">
            <label class="x100">剩余数量:</label>
            <input type="text" name="" data-rule="required" readonly <if condition="$va.num eq '0'">value="无限制"<else/>value="{$num}"</if> />
        </div>
        <div class="form-group">
            <label class="x100">发放数量:</label>
            <input type="text" name="num" data-rule="required" />
        </div>
        <div class="form-group showcode">
        </div>
    </form>
</div>
<script>
    function getcodecall(result, dobj){
        if( result[BJUI.keys.statusCode] == BJUI.statusCode.ok ) {
            var code = result.message.split(',');
            var htmlstr = '';
            htmlstr += '你的优惠券码为:'
            for( var index = 0 ; index < code.length ; index++ ){
                htmlstr += '<p class="text-success"><b>'+code[index]+'</b></p>'
            }
            htmlstr += '<p class="text-danger">可直接在使用情况中查看</p>';
            $('.showcode').html( htmlstr );
        }else{
            dobj.bjuiajax('ajaxDone', result);
        }
    }
</script>
<include file="Common/footer" ftype="save" />